package com.atcumt.xiaoyuan;

import java.util.*;
import java.util.stream.Collectors;

public class HJOD03 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String val = "1234567890+-*";
        List<String> exp = new ArrayList<>();
        char[] charArray = str.toCharArray();
        for (int i = 0; i < str.length(); i++) {
            char ch = charArray[i];
            if (Character.isDigit(ch)) {
                int start = i;
                while (i + 1< charArray.length && val.contains(charArray[i + 1] + "")) {
                    if (!Character.isDigit(charArray[i]) && !Character.isDigit(charArray[i+1])&& charArray[i+1] != '-'){
                        break;
                    }
                    i++;
                }
                if (!Character.isDigit(str.charAt(i))) {
                    exp.add(str.substring(start, i));
                } else {
                    exp.add(str.substring(start, i+ 1));
                }
            }
        }
        Collections.sort(exp, (o1, o2) -> Integer.compare(o2.length(), o1.length()));
        if (exp.size() > 0) {
            String res = calculateExp(exp.get(0));
            System.out.println(res);
        } else {
            System.out.println(0);
        }
    }


    private static String calculateExp(String str) {
        char[] charArray = str.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < charArray.length; i++) {
            if (Character.isDigit(charArray[i])) {
                sb.append(charArray[i]);
            } else if(!Character.isDigit(charArray[i]) && i != charArray.length-1) {
                sb.append(",").append(charArray[i]).append(",");
            }
        }
        List<String> collect = Arrays.stream(sb.toString().split(",")).collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            if (!collect.get(i).equals("+") && !collect.get(i).equals("*") && !collect.get(i).equals("-")) {
                long num = Long.parseLong(collect.get(i));
                collect.set(i, num +"");
            }
        }
        if (collect.size() == 1) {
            return collect.get(0);
        }
        for (int i = 0; i < collect.size(); i++) {
            if (collect.get(i).equals("*")) {
                calculate(collect, i, "*");
                i = 0;
            }
        }
        for (int i = 0; i < collect.size(); i++) {
            if (collect.get(i).equals("+")) {
                calculate(collect, i, "+");
                i = 0;
            }
            if (collect.get(i).equals("-")) {
                calculate(collect, i, "-");
                i = 0;
            }
        }
        return collect.get(0);
    }

    public static void calculate(List<String> list, int i, String op) {
        long a =Long.parseLong(list.get(i - 1));
        long b =Long.parseLong(list.get(i + 1));
        long res =0L;
        if (op == "*") {
            res = a * b;
        } else if (op == "+") {
            res = a + b;
        } else if (op == "-") {
            res = a- b;
        }
        list .set(i, res + "");
        list.remove(i - 1);
        list.remove(i);
    }
}
